﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AssignmentSWEN3.App_Code;
using System.Web.Security;

namespace AssignmentSWEN3
{
    public partial class HotelLogin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void LoginButton_Click(object sender, EventArgs e)
        {
            int staffOID = Convert.ToInt32(TextBox1.Text);
            string password = TextBox2.Text;

            if (DataManager.Login(staffOID, password) == true)
            {
                FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, true);

                Session["staffOID"] = TextBox1.Text;
                Response.Redirect("HotelChoice.aspx");
            }
            else
            {
                Labelerror.Text = "Login unsuccessful Please try again";
            }
        }

        protected void ExitButton_Click(object sender, EventArgs e)
        {
            Response.Redirect("http://google.com"); 
        }
    }
}